#include <stdio.h>

void printHTTPResponseHeader();
void printHTMLHead( void );
void printHTMLEnd( void );

void printDays(void)
{
    unsigned i=1;
    while(i < 32)
    {
        printf("<option>%d</option>\n", i);
        ++i;
    }
}

void printYear(void)
{
    unsigned i;
    for(i = 1950; i < 2012; ++i)
    {
        printf("<option>%d</option>\n", i);
    }
}

void printMonth(void)
{
    char *months[] = {"January","February", "Marth", "April", "May", "June", "July", "August",
                     "September", "October", "November", "December"};
    int i;
    for(i=0; i < 12; ++i)
    {
        printf("<option>%s</option>\n", months[i]);
    }
}

int main( void )
{
    printHTTPResponseHeader();
    printHTMLHead();
    printf("<form action="" method=\"POST\" name=\"form\" enctype=\"text/plain\">\n");
    printf("<h1>Sign Up</h1>\n");
    printf("<p class =\"it\">It`s free and always will be.</p>\n");
    printf("<hr class=\"separator\" size=\"1\">\n");
    printf("<div class =\"main\">\n");
        printf("<div class =\"info\">\n");
            printf("<label for =\"1\">First Name:</label>\n");  
            printf("<input class =\"in\" input type=\"text\" name=\"firstName\" size=\"35\" id=\"1\" /> \n");
        printf("</div>\n");
        printf("<div class=\"info\">\n");
            printf("<label for=\"2\">Last Name:</label>\n");
            printf("<input class=\"in\" input type=\"text\" name=\"lastName\" size=\"35\" id=\"2\" /> \n");
        printf("</div>\n");
        printf("<div class=\"info\">\n");
            printf("<label for =\"3\"> Your Email:</label>\n");  
            printf("<input class=\"in\" input type=\"text\" name=\"eMail\" size=\"35\" id=\"3\" /> \n");
        printf("</div>\n");
        printf("<div class=\"info\">\n");
            printf("<label for=\"4\">Re-enter Email:</label>\n"); 
            printf("<input class=\"in\" input type=\"text\" name=\"reemail\" size=\"35\" id=\"4\"/> \n");
        printf("</div>\n");
        printf("<div class=\"info\">\n");
            printf("<label for=\"5\">New Password:</label>\n"); 
            printf("<input class = \"in\" input type=\"password\" name=\"password\" size=\"35\" id=\"5\"/> \n");
        printf("</div>\n");
        printf("<div class=\"info\">\n");
            printf("<label for=\"select\">I am:</label>\n");
                printf("<select class=\"select\" select name=\"sex\" size=\"1\" id=\"select\">\n");
                    printf("<option selected=\"selected\" value=\"first\">Select Sex:</option>\n");
                    printf("<option value=\"second\">men</option>\n");
                    printf("<option value=\"third\">women</option>\n");
                printf("</select><br />\n");
         printf("</div>\n");
        printf("<div class=\"info\">\n");
        printf("<div class=\"b1\">\n");
            printf("<label for=\"birth\">Birthday:</label>\n");
                printf("<select class=\"birth\" select name=\"month\" size=\"1\" id=\"birth\">\n");
                    printf("<option selected=\"selected\" value=\"first\">Month:</option>\n");
                    printMonth();
                printf("</select>\n");
                printf("<select class=\"birth1\" select name=\"day\" size=\"1\">\n");
                    printf("<option selected=\"selected\" value=\"first\">Day:</option>\n");
                    printDays();
                printf("</select>\n");
                printf("<select class=\"birth2\" select name=\"year\" size=\"1\">\n");
                    printf("<option selected=\"selected\" value=\"first\">Year:</option>\n");
					printYear();
                printf("</select><br />\n");
        printf("</div>\n");
        printf("</div>\n");
        printf("<p class=\"why\">Why do I need to provide this?</p>\n");
        printf("<div class=\"button\">\n");
            printf("<input type=\"image\" img src=\"/images/sign.png\" name=\"submit\">\n");
        printf("</div>\n");
    printf("</div>\n");
printf("</form>\n");
printHTMLEnd();
}

void printHTTPResponseHeader()
{
    printf("Content-type: text/html;charset=utf-8\n\n");
}

void printHTMLHead(void)
{
    printf( "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"\n\"http://www.w3.org/TR/html4/loose.dtd\">\n" );
    printf( "<html>\n" );
    printf( "<head>\n" );
    printf( "<title>Form</title>\n" );
    printf("<link rel=\"stylesheet\" type=\"text/css\" href=\"/css/form.css\">\n");
    printf( "</head>\n" );
    printf( "<body>\n" );
}


void printHTMLEnd(void)
{
    printf( "</body>\n" );
    printf( "</html>\n" );
}
